package com.whl.common.util;

import java.util.Map;

public class SignUtil {
	private final static String eq= "=" ;
	private final static String and= "&" ;
	private final static String key= "key" ;
	private final static String charset= "utf-8" ;
	private final static String sign= "sign" ;
	
	public static String getSign(Map<String,String> map,String signKey){
		
		StringBuilder sb = new StringBuilder();
		for (String key : map.keySet()) {
			if(!key.equalsIgnoreCase(sign)){
				sb.append(key).append(eq).append(map.get(key)).append(and);
			}
		}
		sb.append(key).append(eq).append(signKey);
		String sign = MD5Util.MD5Encode(sb.toString(), charset).toUpperCase();
		return sign ;
	}

}
